package com.firexxx.study.designmodel.visitor;

import java.util.ArrayList;
import java.util.List;

/**
 * @description: TODO
 * @author: zhuangzhang2
 * @date: 2020-12-24 14:48
 */
public class Tree {
    private List<IElement> list = new ArrayList<>();

    public void visit(IVisitor visitor) {
        list.forEach(item -> item.accept(visitor));
    }

    public void add(IElement element) {
        list.add(element);
    }

    public void remove(IElement element) {
        list.remove(element);
    }

}
